home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / util / cli / WinSize.lha / WinSize.c < prev    next >
C/C++ Source or Header  |  1994-11-14  |  847b  |  40 lines

  1. /* This program shows the size of the current window */
  2.  
  3. #include <stdio.h>
  4. #include "proto/exec.h"
  5.  
  6. #include "intuition/intuitionbase.h"
  7.  
  8. struct IntuitionBase *IntBase;
  9.  
  10. void main(int argc, char *argv[])
  11. {
  12.   struct Window *Win;
  13.   if (IntBase = (struct IntuitionBase *) OpenLibrary("intuition.library",0))
  14.     {
  15.       Win = IntBase->ActiveWindow;
  16.       if (argc > 1)
  17.     {
  18.       if ((*argv[1] == '-'))
  19.         {
  20.           switch (argv[1][1])
  21.         {
  22.         case 'c':
  23.         case 'C':
  24.           {
  25.             printf ("%d/%d/%d/%d/",Win->LeftEdge,Win->TopEdge,Win->Width,Win->Height);
  26.             break;
  27.           }
  28.         default:
  29.           {
  30.             printf("Usage: WinSize [-c] , where -c means CON: type output\n");
  31.           }
  32.         }
  33.         }
  34.     }
  35.       else
  36.     printf ("Window Position: %d x %d , Size: %d x %d\n",Win->LeftEdge,Win->TopEdge,Win->Width,Win->Height);
  37.       CloseLibrary((struct Library *) IntBase);
  38.     }
  39. }
  40.